<?php

namespace app\astroapp\controller\v1;

use app\astroapp\controller\AstroAppRemoteAuth;
use app\common\model\Article as ArticleModel;

class Fortune extends AstroAppRemoteAuth
{
    public function weekDetail()
    {
        $inSign = input('in_sign/d', 0);
        if (!in_array($inSign, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], true))
        {
            return show(config('code.error'), '未知星座，请重新再试～');
        }

        $week = (new ArticleModel())->getFortune('week', $inSign);
        $week = arrayKeyData2int($week, ['id', 'cid', 'whole', 'love', 'money', 'career', 'health']);

        return show(config('code.success'), '请求成功', ['week' => $week]);
    }
}